home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.test;
-
- import sub_arctic.lib.*;
- import sub_arctic.input.*;
- import sub_arctic.output.drawable;
- import sub_arctic.constraints.std_function;
-
- import java.awt.Font; // almost didn't need any AWT!
-
- public class debug_top_test extends debug_interactor_applet
- implements callback_object {
-
- public static final int angle_default=25;
- public static final int length_default=20;
- public static final String msg_length="Arrow Head Length: ";
- public static final String msg_angle="Arrow Head Angle: ";
- /* where we know how many arrowheads we need */
- int arrowheads;
- /* do something clever when we get a click */
- public void callback(interactor from_obj,
- event evt,
- int callback_num,
- Object callback_info) {
- int i;
- line_display l;
- /* is it a toggle? */
- if (from_obj instanceof toggle) {
- lp.set_arrow_heads(((Integer)from_obj.user_info()).intValue());
- } else {
- /* its a slider */
- /* loop over all children */
- angle_label.set_text(msg_angle + angle_scale.value());
- length_label.set_text(msg_length + length_scale.value());
- for (i=0; i<lp.num_children();++i) {
- l=(line_display)lp.child(i);
- l.set_arrow_head_length(length_scale.value());
- l.set_arrow_head_angle(angle_scale.value());
- }
- }
-
- }
- /* this is where we hold the line_parent */
- line_parent lp;
- /* angle scale */
- scale angle_scale;
- scale length_scale;
- label angle_label;
- label length_label;
- static String[] arrowhead_labels= {"No Arrow Heads", "One Arrow Head",
- "Two Arrow Heads"};
- /*
- * Set things up ... note: use start() not init()
- */
- public void build_ui(base_parent_interactor top) {
- text_toggle_collection s1;
- column c;
-
- // /* switch out the top */
- // remove_top_interactor();
- // debug_lens_top_level dtop =
- // new debug_lens_top_level(top.x(), top.y(), top.w(), top.h());
- // set_top_interactor(dtop);
- // top = new fake_top_level(dtop);
- //
- // /* turn on debug */
- // dtop.set_debugging(true);
-
- /* initialize arrow heads */
- arrowheads=1;
- /* width and height are bogus */
- c=new column(0,0,10,10,10,3,true,true,true,column.CENTER_JUSTIFIED,
- null);
- s1=new text_toggle_collection(arrowhead_labels,true,150,this);
- /* put the toggle for 1 arrow head on */
- s1.nth_toggle(1).set_cur_state(1);
- /* now build a slider and a label for angle*/
- angle_label=new label(msg_angle + angle_default,
- new Font("Helvetica",Font.BOLD, 16));
- angle_scale=new scale(0,0,200,1,89,angle_default,10,this);
- /* now build a scale and a label for length*/
- length_label=new label(msg_length+ length_default,
- new Font("Helvetica",Font.BOLD, 16));
- length_scale=new scale(0,0,200,1,100,length_default,10,this);
-
- /* put all these interactors in the column */
- c.add_child(s1);
- c.add_child(angle_label);
- c.add_child(angle_scale);
- c.add_child(length_label);
- c.add_child(length_scale);
- /* make it fill */
- c.set_h_constraint(std_function.offset(PARENT.Y2(),0));
- top.add_child(c);
- /* put the line parent in */
- lp=new line_parent();
- top.add_child(lp);
- /* now build the constraints for lp... abut against the column */
- lp.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 0));
- lp.set_y_constraint(std_function.offset(PREV_SIBLING.Y(),0));
- /* initialize lp to be right */
- lp.set_arrow_head_length(angle_default);
- lp.set_arrow_head_angle(length_default);
- /* width and height fill */
- lp.set_w_constraint(
- std_function.fill(PREV_SIBLING.X2(), NEXT_SIBLING.X(), 0));
- lp.set_h_constraint(std_function.offset(PARENT.Y2(), 0));
- }
- }
-
-
-
-
-
-
-
-
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-